Sakai Festival (堺祭)

Sakai Festival (Sakai no Matsuri) is a festival that was held at corner points and boundaries in Oto (imperial capital) and Koku-gun in the governing system in the ancient and medieval period of Japan. The festival is considered originally derived from honoring to the deity of cornor points and boundaries in Sakai to prevent plagues or disasters at gateways to villages, on slopes or peaks, and to pray for safety on the way. The narrative in "Kojiki" about Chigaeshi no Okami, who protects Yomotsu Hirasaka, is said to have some relation with this derivation. Onmyodo was conveyed later from China, and then both were united to form a festival.

Under the government according to the Ritsuryo codes, Jingikan (department of workship) managed "Dokyo-sai Festival" held to protect the borders of the capital. In 735, however, many people died due to the plagues in the area of Dazaifu and then subsequently in Heijo-kyo, the ancient capital of Japan in current Nara, and as a result, similar festivals were held in various countries.
After relocation of national capital to the city of Heiankyo, Dokyo-sai Festival continued to be held
Afterward, similar festivals have increased for prevention of plagues or disasters. "The Engisiki" describes that, when guests from foreign countries entered the capital and went back to their countries, various Sakai Festivals were held such as for gyoko (Emperor's going out) or for leaving the capital for Saigu, including "Kyujo Yosumi Ekijin-sai Festival" performed around the periphery of the dairi (Imperial Palace.)
Afterward, similar festivals have increased for prevention of plagues or disasters.
"The Engisiki" (an ancient book for codes and procedures on national rites and prayers) describes that, when guests from foreign countries entered the capital and went back to their countries, various Sakai Festivals were held such as for gyoko (Emperor's going out) or for leaving the capital for Saigu, including "Kyujo Yosumi Ekijin-sai Festival" performed around the periphery of the dairi (Imperial Palace.)
Kyujo Yosumi Ekijin-sai Festival was later united with Dokyo-sai Festival in Heiankyo to be developed into "Shikyo Shisakai Matsuri " (Festival of Four Borders and Four-corner Points) at four corner points in Heiankyo.

[Original Japanese]